package com.sebarmeli.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;

public class DeleteFilmPage extends Page{
	public DeleteFilmPage(PageManager pages)
	{
			super(pages);
	}
	
	@FindBy(css="img[title='Remove']")
	WebElement delete_button;
	
	
	public DeleteFilmPage ensurePageLoaded()
	{
		super.ensurePageLoaded();
		wait.until(ExpectedConditions.presenceOfElementLocated
				(By.cssSelector("img[title='Remove']")));
		return this;
	}
	
	public FilmsHomePage DeleteFilm()
	{
		delete_button.click();
		wait.until(ExpectedConditions.alertIsPresent());
		driver.switchTo().alert().accept();
		return pages.filmsHomePage;
	}

}
